#include "sqstack.h"

int main(void)
{
	sqstack *stack = stack_create();
	if (stack == NULL)
		exit(1);

	datatype arr[] = {19, 23, 11, 45, 67};
	for (int i = 0; i < sizeof(arr) / sizeof(*arr); i++)
		stack_push(stack, &arr[i]);

	int tmp = 1;
	int ret = stack_push(stack, &tmp);
	if (ret != 0)
		printf("st_push failed\n");
	else
		stack_show(stack); //最不需要的功能，主要目的是写程序时看到效果

	while (stack_pop(stack, &tmp) == 0)
		printf("pop = %d\n", tmp);

	ret = stack_top(stack, &tmp);
	if (ret == 0)
		printf("top = %d\n", tmp);
	else
		printf("栈为空\n");

	stack_destory(stack);

	return 0;
}
